<?php
/*
 * kkFileView文件文档在线预览
 *@link        http://www.dzzoffice.com
* @author      小胡
 *@QQ:         3203164629
 *@time:       20240716
 */
if (!defined('IN_OAOOA') && !defined('IN_ADMIN')) {
	exit('Access Denied');
}
$appname=lang('appname');
$navtitle="设置";
include libfile('function/cache');
if (submitcheck('settingsumbit')) {
    $status = isset($_GET['status']) ? intval($_GET['status']) : 0;
    $host = trim($_GET['host']);
    $watermarkTxt = trim($_GET['watermarkTxt']);
    if($status && !$host){
      exit(json_encode(array('msg'=>'配置信息不完整，请填写完整信息后开启')));
    }
    $arr=array(
        'host'=>trim($_GET['host']),
        'watermarkTxt'=>trim($_GET['watermarkTxt']),
        'status'=>intval($_GET['status'])
    );
    C::t('setting')->update('setting_kkFileViewDataSetting',$arr);
    updatecache('setting');
    exit(json_encode(array('success'=>true)));
}else{
    $setting=C::t('setting')->fetch('setting_kkFileViewDataSetting',true);
    if(!$setting['status']) $setting['status'] = 0;
    include template('setting');
    exit();
}